//
//  MusicInfo.m
//  MusicPlayer-two
//
//  Created by lanou3g on 15/8/21.
//  Copyright (c) 2015年 大展宏图. All rights reserved.
//

#define  HJLog(...) NSLog(__VA_ARGS__)
#import "MusicInfo.h"

@implementation MusicInfo

- (instancetype)initSetValuesForKeysWhitDictionary:(NSDictionary *)dictionary{
    self = [super init];
    if (self) {
        self.timeForLyric = [NSMutableArray new];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}

+ (instancetype)musicInfoSetValuesForKeysWithDictionary:(NSDictionary *)dictionary{

    return  [[MusicInfo alloc]initSetValuesForKeysWhitDictionary:dictionary];
}


//未找到对应的Key值

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }else if ([key isEqualToString:@"lyric"]){
    
        NSArray *rowArray = [value componentsSeparatedByString:@"\n"];
        
        for (NSString *temp in rowArray) {
            if (![temp isEqualToString:@""]) {
                
                NSArray *timeAndLyric = [temp componentsSeparatedByString:@"]"];
                
                NSString *timeString = [[timeAndLyric firstObject] substringWithRange:NSMakeRange(1, 5)];
                NSDictionary *lyricDic = @{timeString:[timeAndLyric lastObject]};
                
                [self.timeForLyric addObject:lyricDic];
            
//                HJLog(@"%@",_timeForLyric);
            }
        }
    
    
    }
    

}


@end
